package com.planetarium;

import java.util.Date;

import com.planetarium.objects.DummySystem;
import com.planetarium.objects.PlanetarySystem;

public class Main {
	
	public static void main(String[] args) {
		PlanetarySystem system = new DummySystem();
		Window window = new Window();
		window.setSolarSystem(system);
		
		long startTime;
		int itterationTime = 1000 / 60;
		
		while (true) {
			startTime = new Date().getTime();
						
			system.update();
			window.invalidate();
			
			try {
				synchronized (window) {	
					window.wait(itterationTime - (new Date().getTime() - startTime));
				}
			} catch (InterruptedException e) {}
		}
		
	}
	
}
